# Contributor: Chloe Kudryavtsev <toast@toastin.space>
# Maintainer: Chloe Kudryavtsev <toast@toastin.space>
pkgname=bat
pkgver=0.15.4
pkgrel=0
pkgdesc="A cat(1) clone with wings"
url="https://github.com/sharkdp/bat"
arch="x86_64 x86 armhf armv7 aarch64 ppc64le" # limited by rust/cargo
license="Apache-2.0"
depends="less" # Required for RAW-CONTROL-CHARS
makedepends="cargo clang-dev llvm-dev"
options="net"
subpackages="$pkgname-doc $pkgname-fish-completion::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/sharkdp/bat/archive/v$pkgver.tar.gz"

export CARGO_HOME="$srcdir"/cargo

build() {
	cargo build --release --locked
}

check() {
	cargo test --release --locked
}

package() {
	install -Dm755 target/release/"$pkgname" "$pkgdir"/usr/bin/"$pkgname"
	find "$srcdir" -name bat.1 -exec install -Dm644 {} \
		"$pkgdir/usr/share/man/man1/bat.1" \;

	find "$srcdir" -name bat.fish -exec install -Dm644 {} \
		"$pkgdir"/usr/share/fish/completions/bat.fish \;
}

sha512sums="f4338799047c1169c759a0ddf61481972d53103c5e29374ec2fb7bf814458ff6b724aacd551264ad7fc5e135c1e4484a38e391e046e76e113d404a92442db538  bat-0.15.4.tar.gz"
